package com.wswy.wzcx.ui.module.lbs

import android.os.Bundle
import com.amap.api.services.core.LatLonPoint
import com.wswy.wzcx.ui.Constants

class CommonLbsMapFragment :LbsBaseMapFragment(){


    companion object {

        fun newInstance(lbsType:LbsType):LbsBaseMapFragment{
            return CommonLbsMapFragment().apply {
                arguments = Bundle().apply {
                    putParcelable(Constants.EXTRA_DATA,lbsType)
                }
            }
        }

    }

    private var lbsType:LbsType?=null

    override fun onActivityCreated(savedInstanceState: Bundle?) {
        super.onActivityCreated(savedInstanceState)

        lbsType= arguments?.getParcelable<LbsType?>(Constants.EXTRA_DATA)

        lbsViewModel.code = lbsType?.poiCode
    }

    override fun onLoadPoiItems(point: LatLonPoint) {
        super.onLoadPoiItems(point)
        lbsViewModel.loadNearby(1)
    }

    override fun getZoom(): Float {
        return lbsType?.defaultZoom?:15f
    }

    override fun getOverlayType(): Int {
        return lbsType?.typeCode?:0
    }



}